package com.novoda.runbuddy.activity;

import android.database.sqlite.SQLiteDatabase;
import android.test.ActivityInstrumentationTestCase;

import com.novoda.runbuddy.R;
import com.novoda.runbuddy.provider.ContentProviderRouteTest;
import com.novoda.runbuddy.util.DBUtil;

public class RouteViewerUnitTest extends ActivityInstrumentationTestCase<RouteViewer> {

	private RouteViewer			activityClasse;

	private SQLiteDatabase		mdb;
	private static final String	TAG				= ContentProviderRouteTest.class.getName();
	private static final String	RUN_BUDDY_DB	= "runBuddyDB1.db";
	private DBUtil				dbUtil			= null;

	public RouteViewerUnitTest(String pkg, Class<RouteViewer> activityClass) {
		super("com.novoda.runbuddy", RouteViewer.class);
	}

	public RouteViewerUnitTest() {
		super("com.novoda.runbuddy", RouteViewer.class);
	}

	@Override
	protected void setUp() throws Exception {
		if (dbUtil == null) {
			dbUtil = new DBUtil(getInstrumentation().getTargetContext(), RUN_BUDDY_DB);
		}
		// insert initial values
		dbUtil.executeDB(R.raw.positron_cp_route_insert);
		// insert more values
		dbUtil.executeDB(R.raw.db_insert_long_route);
		super.setUp();
		
		activityClasse = getActivity();
	}

	@Override
	protected void tearDown() throws Exception {
		if (dbUtil == null) {
			dbUtil = new DBUtil(getInstrumentation().getTargetContext(), RUN_BUDDY_DB);
		}
		dbUtil.executeDB(R.raw.db_delete_all_values);
		super.tearDown();
	}

	@Override
	public void testActivityTestCaseSetUpProperly() throws Exception {
		super.testActivityTestCaseSetUpProperly();
	}

	public void testTrue() throws Exception {
		getInstrumentation().waitForIdleSync();
		Thread.sleep(5000);
		assertTrue(true);
	}
	
	public void testComputeSpan() throws Exception {
		//is.getActivity()
		assertTrue(true);
	}

}
